<template>
  <div class="rule-condition-section">
    <div class="section-header">
      <h3 class="section-title">规则条件</h3>
      <p class="section-description">
        设置触发规则的条件，支持字段名自动补全和逻辑运算符
      </p>
    </div>
    
    <div class="condition-editor-wrapper">
      <condition-editor 
        :value="value"
        @update:value="$emit('update:value', $event)"
        @error="$emit('error', $event)"
      />
    </div>
  </div>
</template>

<script setup lang="ts">
import ConditionEditor from '../ConditionEditor.vue';

defineProps<{
  value: string;
}>();

defineEmits<{
  'update:value': [value: string];
  error: [error: string];
}>();
</script>

<style scoped>
.rule-condition-section {
  border: 1px solid var(--n-border-color);
  border-radius: 8px;
  padding: 16px;
  background: var(--n-color);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.section-header {
  margin-bottom: 16px;
  flex-shrink: 0;
}

.section-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--n-text-color);
}

.section-description {
  margin: 0;
  font-size: 14px;
  color: var(--n-text-color-2);
}

.condition-editor-wrapper {
  flex: 1;
  min-height: 0;
}
</style> 